package com.cetccloud.ap.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;

/**
 * @ClassName GlobalFilter
 * @Description TODO
 * @Author superz
 * @Date 2021/4/10 19:20
 * @Version 1.0
 **/
@Slf4j
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class GlobalFilter implements WebFilter {

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
        log.info("访问url: {}", exchange.getRequest().getPath().pathWithinApplication().value());
        return chain.filter(exchange);
    }
}
